package com.example.wxchatdemo.SQLitess;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class SQLites extends SQLiteOpenHelper {


    public SQLites(Context context, String name, SQLiteDatabase.CursorFactory factory,
                   int version) {super(context, "my.db", null, 6); }
    @Override
    //数据库第一次创建时被调用
    public void onCreate(SQLiteDatabase db) {
        System.out.println("重新创建数据库");
        db.execSQL("CREATE TABLE `wechat`  (  `id` BIGINT(20) NOT NULL ,  `youid` BIGINT(20) NOT NULL, `myid` BIGINT(20) NOT NULL,  `content` varchar(255) ,  `times` BIGINT(20) , 'status' varchar(255), PRIMARY KEY (`id`) ) ;");
     //本地消息列表数据库
        db.execSQL("CREATE TABLE `wechatuser`  (  `id` bigint(20) NOT NULL,  `aName` varchar(255)  NOT NULL,  `aSpeak`varchar(255)   DEFAULT NULL," + "  `aNumber` bigint(20)  DEFAULT NULL," +"  `LastTime` bigint(20)  DEFAULT NULL," +"  `myid` bigint(20) NOT NULL," + "  `friends` bigint(20) NOT NULL," +"  PRIMARY KEY (`id`) " +") ;");
    }
    //软件版本号发生改变时调用
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
      //  db.execSQL("drop table wechat");

        System.out.println("版本号变化");
    }
}
